<template>
    <u-popup v-model="isShow" mode="center" width="80%" border-radius="12" :mask-close-able="false" class="show-agreement">
        <view class="popup-block">
            <scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y">
                <view v-html="content" class="content"></view>
            </scroll-view>
        
            <view class="flex-around">
                <u-button v-if="props.isClose" @click="isShow = false">关闭</u-button>
                <u-button v-if="props.isAgree" class="btn-deepCyan" @click="confirm">同意</u-button>
            </view>
        </view>
	</u-popup>
</template>
<script setup lang="ts">
import agreement from '@/static/js/agreement';
const emit = defineEmits(['confirm']);
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps({
      isClose: {
        type: Boolean,
        default: () => false,
      },
      isAgree: {
        type: Boolean,
        default: () => true,
      },
})
let isShow = ref(false);
let content = ref();
const init = (type) => {
    isShow.value = true;
    content.value = agreement[type];
}
const confirm = () => {
    emit('confirm', true);
    isShow.value = false;
}
defineExpose({
  init,
});
</script>
<style scoped>
.scroll-Y{
    height:800rpx;
    width: auto;
}
.content{
    line-height: 48rpx;
}
</style>